import datetime
from google.appengine.ext import db

class UserMessage(db.Model):
    post_date = db.DateProperty(auto_now=True)
    user_name = db.StringProperty()
    amount = db.FloatProperty()
    location = db.StringProperty()
    story = db.StringProperty()	

def getLatest():
#   q = db.GqlQuery("select city, post_date from UserMessage order by date desc")
    q = UserMessage.all(); 
    q.order("-post_date"); 
    r = q.fetch(5);
#    output = ""
#    for i in r:
#        output += "," +  i.location + str(i.post_date)
    output = []
    for i in r:
        s = {}; s['location']=i.location; s['post_date']=str(i.post_date); output.append(s)
    return output
